class Icon extends HTMLElement {
    static get observedAttributes() {
        return ["name"];
    }

    attributeChangedCallback() {
        const alt = this.getAttribute("name");
        const img = this._mapOfIcon(alt);
        window.requestAnimationFrame(() => {
            this.innerHTML = this.render({ alt, img });
        });
    }

    render({ alt, img }) {
        return `<img
                    class="component_icon"
                    draggable="false"
                    src="${img}"
                    alt="${alt}" />`;
    }

    _mapOfIcon(name) {
        switch (name) {
        case "arrow_right":
            return "";
        case "arrow_left":
            return "";
        case "eye":
            return "";
        case "close":
            return "";
        case "loading":
            return "";
        }
        return "";
    }
}

customElements.define("component-icon", Icon);
